﻿using System.Data;
using System.Data.Entity.Infrastructure;
using Quba.DataAccess.Repositories.Abstract;
using Quba.Entities.Database.Question;

namespace Quba.DataAccess.Repositories.Concrete
{
    public class OptionRepository : QubaBaseRepositoty<Option>, IOptionRepository
    {
        private Option _result;

        #region Get
        public override Option Get(int questionTypeId)
        {
            return _GetQubaContext().Options.Find(questionTypeId);
        } 
        #endregion Get

        #region Update
        public override Option Update(Option admin)
        {
            _result = _GetQubaContext().Options.Add(admin);
            DbEntityEntry entry = _GetQubaContext().Entry(admin);
            entry.State = EntityState.Modified;

            _GetQubaContext().SaveChanges();
            return _result;
        }
        #endregion Update

    }
}